feat(scp): add verbose, interactive, and dry-run flags#1261
Merged
Conversation
git scp/git rscp printed a diff via plain `git diff`/`git diff --stat` with no `--no-pager` and no TTY check, blocking on the user's pager. Add -v/--verbose to print the diff via --no-pager before syncing, and -i/--interactive to also prompt for confirmation before the real push/copy. Both apply to git scp and git rscp, and must precede <remote>. Updates man/git-scp.md and Commands.md.
Add -n/--dry-run to preview a sync without changing anything: rsync runs with -n, and git add --force / ssh ... rm are skipped outright. Implies --verbose, since confirming or previewing with nothing shown is useless. Also restructures scp_and_stage's push/delete blocks from `&&`-chains into if/then, needed to branch on dry-run, which incidentally fixes a latent bug where a non-TTY COLOR_RESET could silently skip the real rsync/git add/ssh rm calls. Updates man/git-scp.md and Commands.md.
git-scp had no test coverage at all. Cover the two paths that need no real remote destination: dry-run must preview without touching the index, working tree, or remote path, and declining the interactive confirmation must abort before anything syncs.
spacewander
reviewed
Jul 7, 2026
spacewander
reviewed
Jul 8, 2026
spacewander
approved these changes
Jul 13, 2026
Collaborator
|
@anderewrey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
-v/--verbose,-i/--interactive, and-n/--dry-runtogit scp/git rscp.-vprints the diff (or an rsync preview) before syncing, via--no-pagerso it can't block on the pager like the current unconditionalgit diffdoes.-ialso prompts for confirmation before the real push/copy.-npreviews with no changes made (implies-v).<remote>.